#include "IEngine.h"
#include "..\Input\IInput.h"
#include "..\Renderer\IRenderer.h"
#include "..\Helper\IHelper.h"
#include "..\..\..\Game\Game.h"

/*Interface Engine class not to be used  no defination for interface*/
/*It should act as base abstarct class*/

IEngine *IEngine::pEngine = 0;

IEngine::IEngine()
{
	if(IEngine::pEngine == 0)
	{
		IEngine::pEngine = this;
	}
	else
	{
		Shutdown();
	}

	mRenderFuncList.clear();
}

IEngine::~IEngine()
{
}

void IEngine::Init()
{
	pGame = new Game(this);

}

void IEngine::Update()
{
	pGame->Update();

	pRenderer->Begin();

	for(int i = 0; i < (int)mRenderFuncList.capacity(); i ++)
	{
		(pGame->*mRenderFuncList[i])();
	}

	pRenderer->Render();

	pRenderer->End();

	pInput->ResetInputs();
}

void IEngine::AddedToRenderFuncList(RenderFuncType value, int piority)
{
	// not yet imp piority
	mRenderFuncList.push_back(value);
}

void IEngine::Shutdown()
{

}
